<?php

define('LOGIC', 'logic\\');
define('DAO', '..\model\\dao\\');
define('DTO', '..\model\dto\\');
define('MYSQL', '..\model\mysql\\');
define('SQL', '..\model\sql\\');
define('SMARTY', 'smarty\\');

function __autoload($class_name) {
    if (file_exists(LOGIC . $class_name . '.class.php')) {
        require_once LOGIC . $class_name . '.class.php';
    } elseif (file_exists(DAO . $class_name . '.class.php')) {
        require_once DAO . $class_name . '.class.php';
    } elseif (file_exists(DTO . $class_name . '.class.php')) {
        require_once DTO . $class_name . '.class.php';
    } elseif (file_exists(MYSQL . $class_name . '.class.php')) {
        require_once MYSQL . $class_name . '.class.php';
    } elseif (file_exists(SQL . $class_name . '.class.php')) {
        require_once SQL . $class_name . '.class.php';
    } elseif (file_exists(SMARTY . $class_name . '.class.php')) {
        require_once SMARTY . $class_name . '.class.php';
    } else {
        echo 'classe não existe  -> ' . $class_name;
    }
}

try {
    $classe = "ControllerLogic" . $_REQUEST['classe'];
    $instance = new ReflectionClass($classe);
    $metodo = $_REQUEST['metodo'];
    $method = new ReflectionMethod($instance->getName(), $metodo);
    $method->invoke(new $classe, $method);
} catch (ReflectionException $e) {
    echo $e->getMessage();
}





